﻿using System;
using fastCSharp;

namespace diantou.web.include
{
    /// <summary>
    /// 获取企业考试
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPage = false, IsPool = true)]
    partial class examReviewer : currentUserView<examReviewer>
    {
        /// <summary>
        /// 企业考试与评审人员关系
        /// </summary>
        private struct exam
        {
            /// <summary>
            /// 企业考试
            /// </summary>
            public diantou.examDataAccess.exam Exam;
            /// <summary>
            /// 评审人员标识
            /// </summary>
            public int UserId;
            /// <summary>
            /// 企业用户标识
            /// </summary>
            public int EnterpriseId;
            /// <summary>
            /// 评审人员是否添加到考试
            /// </summary>
            private bool? isExam;
            /// <summary>
            /// 评审人员是否添加到考试
            /// </summary>
            public bool IsExam
            {
                get
                {
                    if (isExam == null)
                    {
                        isExam = diantou.examDataAccess.tcpCall.examReviewer.isUser(Exam.Id, UserId, EnterpriseId);
                    }
                    return (bool)isExam;
                }
            }
        }
        /// <summary>
        /// 企业考试与评审人员关系集合
        /// </summary>
        [fastCSharp.emit.webView.clearMember]
        private exam[] exams;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        private bool loadView(int userId)
        {
            diantou.examDataAccess.exam[] exams = diantou.examDataAccess.clientCache.Exam.Get(diantou.examDataAccess.tcpCall.exam.getIdsByReview(currentUser.Id));
            this.exams = exams.getArray(value => new exam { Exam = value, UserId = userId, EnterpriseId = currentUserId });
            return true;
        }
    }
}